package model.factories.turtlequeries;

import java.util.Map;
import java.util.Scanner;
import java.util.regex.Pattern;
import model.Interpreter;
import model.SyntaxErrorException;
import model.commands.Command;
import model.commands.turtlequeries.ShowingCommand;
import model.factories.CommandFactory;

/**
 * A factory that creates ShowingCommand objects.
 *
 * @author Erick Gonzalez
 */
public class ShowingCommandFactory extends CommandFactory {

    
    private final Pattern myShowingPattern = Pattern.compile("SHOWING?|SHOWINGP");
    
    /**
     * 
     * @param interpreter an interpreter
     */
    public ShowingCommandFactory (Interpreter interpreter) {
        super(interpreter);
    }

    @Override
    public Command createCommand (Scanner commandReader, 
                                  Map<String, Integer> variables) throws SyntaxErrorException {
        commandReader.next();
        return new ShowingCommand();
    }

    @Override
    public Pattern patternToMatch () {
        return myShowingPattern;
    }

}
